<?php 
include 'component/header.php';
include 'component/slidebar.php'; 
?>
<!-- BEGIN CONTENT -->
<div id="content">
    <div class="box-out">
    	<div class="box-in">
    		<div class="box-head"><h1>Quản lý nhóm người dùng...</h1></div>
    		<div class="box-content">
                <div class="table">
    				<form action="<?php echo url('admin','groups-action')?>" method="post">
    					<table>
    						<thead>
    							<tr>
    								<td class="checkbox"><div><input type="checkbox" class="check_all" /></div></td>
    								<td><div>Tên nhóm</div></td>
    								<td><div>Actions</div></td>
    							</tr>
    						</thead>
    						<tbody>
                            <?php
                            require_once WEB_ROOT.'/application/library/Pager.php';
                            $current = 1;
                            if(isset($_GET['page']) && intval($_GET['page']) > 0){
                                $current = $_GET['page'];
                            }
                            $pager = new Pager(array(
                                'rowperpage' =>10,
                                'total_rows' =>$Bus->Group->countTotalRow(),
                                'currentpage'=>(isset($_GET['page']) && intval($_GET['page']) > 0)?$_GET['page']:1,
                                'link'       =>url('admin','groups-manager')
                            ));
                            
                            
                            
                            $Dtos = $Bus->Group->getItemsPager($pager->getRowStart() ,$pager->getRowPerPage());
                            foreach($Dtos as $key=> $dto) { ?>
    							<tr>
    								<td class="checkbox">
                                        <div class="even">
                                            <input type="checkbox" name="<?php echo $dto->idgroups;?>"/>
                                        </div>
                                    </td>
    								<td><div class="even"><?php echo $dto->groups_name; ?></div></td>
    								<td class="action">
                                        <div class="even">
                                            <a class="tooltip" href="<?php echo url('admin','groups-edit',array('id'=>$dto->idgroups));?>" title="Sữa nhóm người dùng này">Sữa</a> - 
                                            <a class="tooltip" href="<?php echo url('admin','groups-del',array('id'=>$dto->idgroups));?>" title="Xóa nhóm người dùng này">Xóa</a>
                                        </div>
                                    </td>
    							</tr>
                            <?php } ?>
    						</tbody>
    					</table>
    					<div class="actions">
    						<select class="applyfield" name="command">
                                <option value="none">Choose</option>
                                <option value="add">Thêm</option>
                                <option value="delete">Xóa</option>
                                <option value="edit">Sữa</option>
    						</select>
    						<input type="submit" class="apply" value="apply" name="btSubmit" />
    					</div><!-- end div .actions -->
                        <div class="pagination">
                            <?php  $pager->showPager(); ?>
                        </div>
                        
    				</form>
    			</div>
    		</div><!-- end div .box-content -->
    	</div><!-- end div .box-in -->
</div><!-- end div #content -->
<!-- END CONTENT -->

<?php
include 'component/footer.php'; 
?>
